package practice;

import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvFileSource;

import static org.junit.jupiter.api.Assertions.assertEquals;

/**
 * @Title: Triangle2.java
 * @Package com.example.software_test.practice
 * @Description: 用边界值分析方法测试
 * @author yjk
 * @version V1.0
 */
public class TriangleTest2 {

    @DisplayName("一般边界值方法")
    @ParameterizedTest
    @CsvFileSource(resources = "/files/triangle.csv")
    void paramTriangle(int a, int b,int c,String expected) {
        Triangle triangle = new Triangle();
        String type = triangle.classify(a, b, c);
        assertEquals(expected, type);
    }

    @DisplayName("健壮性边界值方法")
    @ParameterizedTest
    @CsvFileSource(resources = "/files/triangle1.csv")
    void paramTriangle1(int a, int b,int c,String expected) {
        Triangle triangle = new Triangle();
        String type = triangle.classify(a, b, c);
        assertEquals(expected, type);
    }

    @DisplayName("最坏情况一般边界值分析方法")
    @ParameterizedTest
    @CsvFileSource(resources = "/files/triangle2.csv")
    void paramTriangle2(int a, int b,int c,String expected) {
        Triangle triangle = new Triangle();
        String type = triangle.classify(a, b, c);
        assertEquals(expected, type);
    }

    @DisplayName("最坏情况健壮性边界值分析方法")
    @ParameterizedTest
    @CsvFileSource(resources = "/files/triangle3.csv")
    void paramTriangle3(int a, int b,int c,String expected) {
        Triangle triangle = new Triangle();
        String type = triangle.classify(a, b, c);
        assertEquals(expected, type);
    }
}
